import request from "./index";

/**
 * 获取用户社交
 * @param userId {string | number}
 * @returns {Promise}
 */
export function getSocialList(userId) {
  return request({
    url: "/social",
    params: {
      userId
    }
  })
}

/**
 * 删除一个社交
 * @param socialId {string | number}
 * @returns {Promise}
 */
export function deleteSocial(s_id) {
  return request({
    url: "/social",
    method: "DELETE",
    data: {
      s_id
    }
  })
}

/**
 * 修改一个社交
 * @param s_id {string | number}
 * @param socialId {string | number}
 * @param socialValue {string}
 * @param socialLink {string}
 * @returns {Promise}
 */
export function updateSocial(s_id, socialId, socialValue, socialLink) {
  return request({
    url: "/social",
    method: "PATCH",
    data: {
      s_id,
      socialId,
      socialValue,
      socialLink
    }
  })
}

/**
 * 创建一个社交
 * @param socialId {string | number}
 * @param socialValue {string}
 * @param socialLink {string}
 * @returns {Promise}
 */
export function createSocial(socialId, socialValue, socialLink) {
  return request({
    url: "/social",
    method: "POST",
    data: {
      socialId,
      socialValue,
      socialLink
    }
  })
}

/**
 * 获取社交类型
 * @returns {Promise}
 */
export function getSocialType() {
  return request({
    url: "/social/type"
  })
}
